package com.flyllp.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.flyllp.common.mail.MailSender;
import com.flyllp.common.mail.MailSenderInfo;
import com.flyllp.service.UserService;

@Controller
public class LoginController
{

	@Autowired
	private UserService userService;
	
	@Autowired
	private MailSender mailSender;

	@RequestMapping(value = { "/login", "" })
	public String login()
	{
		userService.login();
		
		MailSenderInfo info1 = new MailSenderInfo();
		info1.setToAddress("flyllp@126.com");
		info1.setSubject("test1");
		info1.setContent("llp_test1");
		mailSender.mailToQueue(info1);
		
		MailSenderInfo info2 = new MailSenderInfo();
		info2.setToAddress("56734961@qq.com");
		info2.setSubject("test2");
		info2.setContent("llp_test2");
		mailSender.mailToQueue(info2);
		
		
		mailSender.sendMail();
		
		return "login";
	}
}
